This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git checkout . | |
git clean -xdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List containers | |
lxc-ls -f -Fname,pid | |
# Get container pid | |
lxc-ls -f -Fpid mycontainer | |
# Access file system | |
cat /proc/containerpid/root/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% sudo apt-get install software-properties-common | |
% sudo apt-add-repository ppa:swi-prolog/stable | |
% sudo apt-get update | |
% sudo apt-get install swi-prolog | |
edge(1,2) | |
edge(2,3) | |
edge(3,4) | |
edge(2,6) | |
edge(6,7) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1="\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Thanks to https://github.com/twbs/bootstrap/issues/27124#issuecomment-509009622 | |
.accordion div.card:only-child { | |
border-bottom: 1px solid rgba(0, 0, 0, 0.125); | |
border-radius: calc(0.25rem - 1px); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE tbl | |
SET field_to_update = CASE | |
WHEN (SELECT COUNT(*) FROM (SELECT * FROM tbl) AS copy WHERE copy.field=<condition> HAVING COUNT(*)>0) THEN "this_value_if_true" | |
ELSE field_to_update | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add to your html header | |
<script src="https://momentjs.com/downloads/moment.js"></script> | |
// Add these two functions | |
function buildInterval(start, end){ | |
var range = []; | |
var time = moment.duration(start).asSeconds(); | |
if(end<=start) | |
var endtime = moment.duration(end).asSeconds()+86400; | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
//Checkout my improvement on StackOverflow: https://stackoverflow.com/a/34699164/6303265 | |
var tmr = 0; | |
var islong = 0; | |
$(element).mousedown(function () { | |
tmr = setTimeout(function () { | |
// Handle the long-press | |
alert("You clicked for 1 second!"); | |
console.log("You clicked for 1 second!"); | |
islong=1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
line_buffer = [] | |
if(len(sys.argv)<2): | |
print("Please provide a file path") | |
exit() | |
filepath = sys.argv[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Widget build(BuildContext context) { | |
var i = 0; | |
var itemCount = 5; | |
return Scaffold( | |
appBar: AppBar(title: const Text('Scrollable list')), | |
body: itemCount > 0 | |
? CustomScrollView( | |
shrinkWrap: true, |