Skip to content

Instantly share code, notes, and snippets.

View TheYahya's full-sized avatar
🐢

Yahya SayadArbabi TheYahya

🐢
View GitHub Profile
@candlerb
candlerb / go-project-layout.md
Last active April 24, 2024 19:22
Suggestions for go project layout

If someone asked me the question "what layout should I use for my Go code repository?", I'd start by asking back "what are you building: an executable, or a library?"

Single executable

Stage 1: single source file

Create a directory named however you want your final executable to be called (e.g. "mycommand"), change into that directory, and create the following files:

@SamadiPour
SamadiPour / snappfood.js
Last active January 8, 2024 09:37
Snappfood Spent money
cookies = Object.fromEntries(document.cookie.split('; ').map(c => c.split('=')));
let UDID = cookies.UDID;
let jwt = cookies[['jwt-access_token']] ?? JSON.parse(window.localStorage.JWT ?? '{}').access_token;
var myHeaders = new Headers();
myHeaders.append("authority", "snappfood.ir");
myHeaders.append("accept", "application/json, text/plain, */*");
myHeaders.append("accept-language", "en-US,en;q=0.9,fa;q=0.8");
myHeaders.append("authorization", "Bearer " + jwt);
myHeaders.append("content-type", "application/x-www-form-urlencoded");
@prologic
prologic / LearnGoIn5mins.md
Last active June 20, 2024 04:04
Learn Go in ~5mins
@arashmidos
arashmidos / Main.kt
Created October 4, 2020 19:42
Irancell harassment
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
submit.setOnClickListener {
val number = smsNumber.text.toString()
val text = smsText.text.toString()
val count: Int = smsCount.text.toString().toInt()
val smsManager = SmsManager.getDefault()
@arastu
arastu / current_track.applescript
Last active November 27, 2020 19:52
update twitter bio and add current playing song from Spotify to it
on escape_quotes(string_to_escape)
set AppleScript's text item delimiters to the "\""
set the item_list to every text item of string_to_escape
set AppleScript's text item delimiters to the "\\\""
set string_to_escape to the item_list as string
set AppleScript's text item delimiters to ""
return string_to_escape
end escape_quotes
tell application "Spotify"
@nainemom
nainemom / subtranslate.lua
Last active April 26, 2024 04:03
MPV script to translate current line of subtitle
-- Simple mpv script to translate subtitle using crow (online) or sdcv (offline) dictionaries.
-- INSTALLATION:
-- To install it, first install crow (https://crow-translate.github.io) and/or sdcv (http://dushistov.github.io/sdcv/) on your marchine with your favorite dicts and then,
-- copy this file to '~/.config/mpv/scripts/' (Linux) or '%AppData%\mpv\scripts\' (Windows).
-- sdcv help:
-- you can download offline dicts from http://download.huzheng.org/Quick/ (or anywhere else) and copy extracted dic folder to '~/.stardict/dic/'
-- CONFIGURATION:
local config = {
const request = require('request')
const cheerio = require('cheerio')
function alexaStats (domain) {
return new Promise((resolve, reject) => {
request({
url: `http://www.alexa.com/siteinfo/${domain}`,
headers: {
Host: 'www.alexa.com',
Referer: `http://www.alexa.com/siteinfo/${domain}`,
@arastu
arastu / airpods-toggle.applescript
Last active March 29, 2021 08:47
Connect/disconnect AirPods automatically on Mac
-- Forked from: https://coderwall.com/p/fyfp0w/applescript-to-connect-bluetooth-headphones
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer"
set btMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth")
tell btMenu
click
tell (menu item "PUT_YOUR_AIRPODE_NAME_HERE" of menu 1) -- Touhid’s AirPods not Touhid's AirPods
click
if exists menu item "Connect" of menu 1 then

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@behroozam
behroozam / rename.py
Created July 27, 2019 07:20
rename by CSV
#!/usr/bin/env python3
import os
import csv
# Coded by behroozam
# Twitter @b3hroozam
CSV_FILE_LOCATION = "./trim.csv"
PICTURES_SRC = "pictures/"