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
#!/bin/sh | |
# Install Docker | |
curl -sSL https://get.docker.com/ | sh |
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
#!/bin/bash | |
# Stop all containers | |
docker stop $(docker ps -a -q) | |
# Delete all containers | |
docker rm $(docker ps -a -q) | |
# Delete all images | |
docker rmi $(docker images -q) |
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
# delete history | |
history -cw | |
# or | |
cat /dev/null > ~/.bash_history && history -c && exit |
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
private static string[] _persistentDataPaths; | |
public static bool IsDirectoryWritable(string path) { | |
try { | |
if (!Directory.Exists(path)) return false; | |
string file = Path.Combine(path, Path.GetRandomFileName()); | |
using (FileStream fs = File.Create(file, 1)) {} | |
File.Delete(file); | |
return true; | |
} catch { |
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
using Xamarin.Forms; | |
namespace System.Threading.Tasks { | |
public static class MainQueue { | |
static int mainThreadId = int.MinValue; | |
public static void Init() { | |
Init(Environment.CurrentManagedThreadId); | |
} |
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
function tprint(t, s) | |
for k, v in pairs(t) do | |
local kfmt = '["' .. tostring(k) ..'"]' | |
if type(k) ~= 'string' then | |
kfmt = '[' .. k .. ']' | |
end | |
local vfmt = '"'.. tostring(v) ..'"' | |
if type(v) == 'table' then | |
tprint(v, (s or '')..kfmt) | |
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
function stripchars(str, chrs) | |
local s = str:gsub("["..chrs:gsub("%W","%%%1").."]", '') | |
return s | |
end |