Skip to content

Instantly share code, notes, and snippets.

View ukazap's full-sized avatar

Ukaza Perdana ukazap

View GitHub Profile
@ukazap
ukazap / elgamal.rb
Created December 16, 2015 23:47
Contoh Mainan Algoritma Elgamal dalam Ruby
require 'prime'
####### PEMBANGKITAN KUNCI OLEH ALICE
# Pilih sembarang bilangan prima p (p dapat di-share di antara anggota kelompok)
p = Prime.take(1000).last #bilangan prima ke-1000
# Pilih dua buah bilangan acak, g dan x, dengan syarat g < p dan 1 <= x <= p – 2
g, x = nil
until g != x
@ukazap
ukazap / jenengi.rb
Last active January 20, 2016 01:25
Ruby script for recursively renaming current directory's files and folders to fix Windows invalid characters: /\?%*|"<>
#!/usr/bin/env ruby
pwd = Dir.pwd
puts pwd + "\n#{"="*pwd.length}"
entries = Dir.glob(pwd+"/**/*", File::FNM_DOTMATCH)
renamed = 0
entries.reverse.each do |file|
unless File.basename(file) =~ /^(\.\.|\.)\z/
@ukazap
ukazap / google.xml
Last active September 12, 2016 23:58
Google Search plugin for web browsers with suggestions
<OpenSearchDescription>
<ShortName>Google</ShortName>
<Description>Google</Description>
<Tags>google</Tags>
<Image height="16" width="16" type="image/vnd.microsoft.icon">http://www.google.com/favicon.ico</Image>
<Url type="text/html" template="http://www.google.com/search?q={searchTerms}"/>
<Url type="application/x-suggestions+json" method="GET" template="https://www.google.com/complete/search?client=firefox&amp;q={searchTerms}"/>
</OpenSearchDescription>
@ukazap
ukazap / flat_list_to_tree.js
Last active November 10, 2017 05:26
Write a function that take source and convert to target.
let source = [
{
name: "Account A"
},
{
name: "Account B"
},
{
name: "Account C"
},
@ukazap
ukazap / introrx.md
Created January 19, 2018 04:21 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ukazap
ukazap / multiple_ssh_setting.md
Created April 4, 2018 16:14 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@ukazap
ukazap / svgicon.css
Created June 5, 2018 03:11 — forked from MoOx/svgicon.css
Svg icons with React.js with webpack loader (svg: raw-loader)
.SVGIcon {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* fix webkit/blink poor rendering issues */
transform: translate3d(0,0,0);
/* it's better defined directly because of the cascade shit
width: inherit;
height: inherit;
@ukazap
ukazap / web-servers.md
Created June 24, 2018 00:35 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ukazap
ukazap / puma.service
Created September 7, 2018 05:46 — forked from arteezy/puma.service
Manage Puma with systemd on Ubuntu 16.04 and rbenv
[Unit]
Description=Puma Rails Server
After=network.target
[Service]
Type=simple
User=deploy
WorkingDirectory=/home/deploy/app/current
ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec puma -C /home/deploy/app/shared/config/puma.rb
ExecStop=/home/deploy/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/deploy/app/shared/tmp/pids/puma.state stop
@ukazap
ukazap / sketch-never-ending.md
Created September 11, 2018 02:17 — forked from Bhavdip/sketch-never-ending.md
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com