Skip to content

Instantly share code, notes, and snippets.

View linxlunx's full-sized avatar

Linggar Primahastoko linxlunx

View GitHub Profile
@linxlunx
linxlunx / go-echo-validator.go
Created October 17, 2023 04:08
Go Echo with Validator
package main
import (
"net/http"
"github.com/go-playground/validator/v10"
"github.com/labstack/echo/v4"
)
type UserDetail struct {
@linxlunx
linxlunx / gist:acffc272f627d9e8728a7d3aaef7eb0d
Created June 19, 2023 04:54 — forked from pvieito/gist:ee6d2c8934a8f84b9aeb467585277b8a
Consumer keys of official Twitter clients

Twitter API Keys

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for Google TV

Consumer key: iAtYJ4HpUVfIUoNnif1DA

@linxlunx
linxlunx / docker-run.sh
Created December 15, 2022 08:38
Promtail config and docker run
docker run -it --rm --name containerName -p 80:80 --log-driver json-file --log-opt tag="{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}" imageName:imageTag
@linxlunx
linxlunx / concurrent_url_request.py
Created October 28, 2022 03:18
Multithread using concurrent.futures
import requests
from time import time
from concurrent.futures import ThreadPoolExecutor, as_completed
now = time()
urls = ['https://linggar.asia', 'https://detik.com', 'https://kompas.com']
def download_page(url):
return requests.get(url).links
@linxlunx
linxlunx / teblak-katla.py
Last active February 10, 2022 23:23
Teblak Katla
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import requests
import json
import base64
def new_decoder(encoded):
equalsigns = '=' * int(encoded[-1])
@linxlunx
linxlunx / venv_upgrade.sh
Last active December 16, 2021 05:26 — forked from pujianto/venv_upgrade.sh
Script to rebuild virtualenv after upgrading the python version
#!/bin/bash
# This script is for rebuilding the virtualenv when using virtualenvwrapper
# Sometimes the virtualenv is broken after upgrading the python version
# Inspired from https://gist.github.com/pujianto/7df2413d64480f7797e1f0c434841283
#
# Usage:
# $ ./venv_upgrade.sh
# Input your virtualenvs base directory then select the virtualenv you want to rebuild
if [ "`command -v pip`" == "" ]; then
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
autocrlf = input
[rerere]
enabled = 1
autoupdate = 1
[push]
default = matching
# forward from windows to wsl
netsh interface portproxy add v4tov4 listenport=8000 listenaddress=0.0.0.0 connectport=8000 connectaddress=127.0.0.1
# remove forwarding
netsh interface portproxy delete v4tov4 listenport=8000 listenaddress=0.0.0.0
# add to first column for matching purpose (lower char), $3 is key to be matched
cat first.csv | awk -F"," 'BEGIN { OFS = "," }; {$1=tolower($3) OFS $1; print}' > firstWithLow.csv
# remove match line by first column
awk -F"," 'NR==FNR{a[$1]++;next} !(a[$1])' exclude_list.csv master_file.csv > outfile.csv
# remove first column
cat outfile.csv | cut -d"," -f2- > outfileclean.csv
sqlcmd -S localhost -U SA -W -d db_name -h -1 -Q "SET NOCOUNT ON;select * from table_name" -o "file_name.csv" -s"," -w 10000