Skip to content

Instantly share code, notes, and snippets.

View al3rez's full-sized avatar

Alireza Bashiri al3rez

View GitHub Profile
{
"type": "object",
"required": ["user"],
"properties": {
"user" : {
"type" : "object",
"required" : [
"id",
"token",
"token_expired_at",
### Keybase proof
I hereby claim:
* I am azbshiri on github.
* I am azbshiri (https://keybase.io/azbshiri) on keybase.
* I have a public key whose fingerprint is 5576 2694 3AF1 4E42 5673 F3CD 3D40 840A 6E62 F2DE
To claim this, I am signing this object:
#include <stdio.h>
#include <unistd.h>
int
tomat(int length, FILE *stdout_)
{
int remain = 0;
while ((remain = (length -= 1)) != 0)
{
fprintf(stdout_, "00:%d\n", remain);
# Given a user containing a `first_name` and a `last_name` methods, write a `handle`
# method that returns a generated handle that follow the following rules:
# - It must be preceded by an @
# - It must be all lowercase
# - It contains the first letter of the first name, and all the letters of the last
# name (for "John" "Doe", it'd be @jdoe)
# - If the first name contains more than one name, get the first letter of each name
# ("John Fitzgerald Wood" "Doe" becomes @jfwdoe)
# - If the last name contains more than one name, get all the letters of the last one,
# and the first letter of each other ("John" "Fitzgerald Wood Doe" becomes @jfwdoe)
@al3rez
al3rez / bing_bg.sh
Created June 20, 2016 17:35
A simple script to easily get Bing’s image of the day
#!/usr/bin/env bash
bing_bg() {
local host='http://bing.com'
local path='HPImageArchive.aspx'
local query="format=js&idx=${1:-0}&n=1&mkt=en-US"
curl -s "$host/$path?$query" |\
jq --arg host "$host" -r '$host + .images[0].url'
}
#include <stdio.h>
main()
{
int c;
int len;
len = 0;
while ((c = getchar()) != EOF)
{
#include <stdio.h>
/* copy input to ouput and replace each tab by \t,
* each backspace by \b, and each backslash by \\
*/
main()
{
int c;
@al3rez
al3rez / js.vim
Created January 1, 2016 21:40 — forked from lukaszkorecki/js.vim
" replace 'function' with λ
au BufNewFile,BufRead *.js syntax keyword javasScriptFunction function conceal cchar=λ
au BufNewFile,BufRead *.js hi! link javasScriptFunction Conceal
au BufNewFile,BufRead *.js setlocal conceallevel=2
" add abbreviations for JS
" f_
" expands to
" function() {
" <cursor>
"
order += "disk /home"
order += "wireless wlan0"
order += "ethernet ppp0"
order += "cpu_usage"
order += "volume master"
order += "tztime local"
wireless wlan0 {
format_up = "WiFi: %ip %quality %essid %bitrate"
format_down = "WiFi: (/)"
URxvt.font: xft:Inconsolata\\-g:style=g:size=12:weight=110
URxvt.letterSpace: -1
URxvt.boldFont:
! --- Disable scrollbar
URxvt.scrollBar: false
! --- Change the font size with the up and down arrow keys
URxvt.perl-ext-common: ...,font-size
URxvt.keysym.C-Up: font-size:increase
URxvt.keysym.C-Down: font-size:decrease