This file contains hidden or 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
| package main | |
| import ( | |
| "database/sql" | |
| "encoding/json" | |
| "fmt" | |
| "io" | |
| "reflect" | |
| "strings" |
This file contains hidden or 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
| #!/usr/bin/env sh | |
| # 'ab' program freezes after lots of requests, why? | |
| # http://stackoverflow.com/questions/1216267/ab-program-freezes-after-lots-of-requests-why | |
| # Enter sudo mode | |
| sudo -i | |
| # net.inet.ip.portrange.first: 49152 -> 32768 | |
| sysctl -w net.inet.ip.portrange.first=32768 |
This file contains hidden or 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
| top -stats "command, cpu" | grep --line-buffered "iTerm2" > cpu.log |
This file contains hidden or 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
| // https://go.dev/play/p/tv4dfbu6jtk | |
| package main | |
| import ( | |
| "fmt" | |
| "sync" | |
| "time" | |
| ) | |
| func doProcess(wg *sync.WaitGroup, n int) string { |
This file contains hidden or 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
| from app.models import myModel | |
| import csv | |
| from datetime import datetime | |
| start = (datetime(2019, 11, 1) - datetime(1970, 1, 1)).total_seconds() | |
| start = (datetime(2020, 3, 1) - datetime(1970, 1, 1)).total_seocnds() | |
| entries = myModel.objects.filter(epoch_field__gte=start, epoch_field__lte=end) | |
| with open("csvfile.csv", "wb") as csvfile: |
This file contains hidden or 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
| ./manage.py makemigrations --dry-run | |
| Migrations for 'audiencefilters': | |
| audiencefilters/migrations/0002_auto_20200120_0956.py | |
| - Alter field condition on targetaudiencefilters | |
| Migrations for 'badges': | |
| badges/migrations/0002_auto_20200120_0956.py | |
| - Change Meta options on badge | |
| - Alter field custom_data on badge | |
| - Alter field redeem_validation on badge | |
| Migrations for 'challenges': |
This file contains hidden or 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
| export const expenseFormPlugin = (state, action) => { | |
| if (action.type === '@@redux-form/CHANGE' && action.meta && action.meta.form === 'expenseForm' && action.meta.field) { | |
| if (action.meta.field === 'time' || action.meta.field === 'rate') { | |
| const time = state.values.time? parseInt(state.values.time, 10) : 0 | |
| const rate = state.values.rate ? parseInt(state.values.rate, 10): 0 | |
| const total = time * rate | |
| return { | |
| ...state, | |
| values: { | |
| ...state.values, |
This file contains hidden or 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 requests | |
| from tabulate import tabulate | |
| import time | |
| import sys | |
| id_wilayah = 25823 # jakarta | |
| interval_request = 60 # detik | |
| def main(): |
This file contains hidden or 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
| yum install libxslt-devel |
This file contains hidden or 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
| #!/usr/bin/python | |
| import urllib2 | |
| import sys | |
| from xml.dom.minidom import parseString | |
| """ | |
| untuk membuka koneksi ke noisette, menggunakan urllib2 | |
| untuk parsing xml menggunakan parseString dari xml | |
| """ |
NewerOlder