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
#recurcive pattern, to sum | |
one = 1; two = 1 | |
10.times do |i| | |
if i <= 1; calc = one | |
else | |
calc = one + two | |
one, two = two, calc | |
end | |
p calc | |
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
import UIKit | |
class Demo: NSObject { | |
func clojure() -> (index:Int) -> Dictionary<Int, Int> { | |
var dict = [:] as Dictionary<Int, Int> | |
var r = { (index:Int) -> Dictionary<Int, Int> in | |
dict[index] = index * 10 | |
return dict | |
} | |
return r |
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 | |
docker ps -a | awk '/[a-z0-9]+/ {print $1}' | xargs docker rm -f |
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 | |
docker images | awk '/[a-z0-9]+/ {print }' | xargs docker rmi -f |
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
# /etc/systemd/system/wifi-resume.service | |
# sudo systemctl enable wifi-resume.service | |
# [checking]systemctl list-unit-files -t service | grep wifi | |
[Unit] | |
Description=Restart networkmanager at resume | |
After=logout.target | |
After=suspend.target | |
After=hibernate.target | |
After=hybrid-sleep.target |
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
# english/japanese dictionary | |
function dict() { | |
grep $1 $HOME/Documents/gene-utf8.txt -A 1 -wi --color | |
} | |
# Fix code when logout, suspend, dont work wifi | |
#sudo -s service network-manager restart | |
# get global ip | |
function gip() { |
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 list --installed | grep -o -E "([a-z.0-9-]+)/" | grep -o -E "9-]+" | perl -pe 's/\n/ /g' |
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
remove mod1 = Alt_L Alt_R | |
keycode 64 = Zenkaku_Hankaku Kanji | |
keycode 108 = Zenkaku_Hankaku Kanji |
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 | |
DATE=`date "+%s"` | |
echo $DATE | |
DATE2=$(($DATE*2)) | |
echo $DATE2 | |
aws logs put-log-events --log-group-name scorpio --log-stream-name app --log-events timestamp=$DATE2,message="Test event 1" --sequence-token $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
class Demo | |
@obj: Coin | |
def initialize(name : String) | |
if name == "LTC" | |
@obj = LTC.new | |
elsif name == "ETH" | |
@obj = ETH.new | |
else | |
raise "Not found name" | |
end |
OlderNewer