Skip to content

Instantly share code, notes, and snippets.

View katz's full-sized avatar

Katsuyuki Sakai katz

View GitHub Profile
@nebgnahz
nebgnahz / shaper
Last active May 27, 2022 10:45
Traffic Shape using `tc` for Linux
#!/bin/bash
set -e
function usage() {
cat << EOF
USAGE:
./shaper start <interface> <bw as XXX kbit>
./shaper clear <interface>
./shaper show <interface>
EOF
@ar-android
ar-android / Api.java
Created November 10, 2016 16:59
OkHttp With RxAndroid and RxJava
public static Observable<Response> getData() {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
final OkHttpClient client = new OkHttpClient();
final Request request = new Request.Builder()
.url("https://github.com/ar-android/panfic/raw/master/Panfic/gen/com/ocit/data.json")
.get()
.addHeader("cache-control", "no-cache")
@CESARDELATORRE
CESARDELATORRE / project.json
Created June 29, 2016 17:20
Sample project.json of ASP.NET Core 1.0 RTM supporting multiple frameworks
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
@baywet
baywet / PublishAspNet5Website.ps1
Last active April 22, 2016 06:47
Fix of PublishAspNet5Website given by microsoft to support slots
param($websiteName, $packOutput, $slot)
#fix for the script provided here https://msdn.microsoft.com/en-us/Library/vs/alm/Build/azure/deploy-aspnet5?f=255&MSPPError=-2147217396
$website = $null;
$baseUrl = $websiteName;
if($slot -eq $null){
$website = Get-AzureWebsite -Name $websiteName
} else {
$baseUrl += "-" + $slot
$website = Get-AzureWebsite -Name $websiteName -Slot $slot
}
@palankai
palankai / specification.py
Last active March 29, 2024 10:02
Python Specification Pattern
class Specification:
def __and__(self, other):
return And(self, other)
def __or__(self, other):
return Or(self, other)
def __xor__(self, other):
return Xor(self, other)
@ouchadam
ouchadam / gist:876aa29b80752ecaaa08
Created January 25, 2016 15:18
exoplayer x86 hack
private static Pair<String, CodecCapabilities> getMediaCodecInfoInternal(CodecKey key,
MediaCodecListCompat mediaCodecList) {
String mimeType = key.mimeType;
int numberOfCodecs = mediaCodecList.getCodecCount();
boolean secureDecodersExplicit = mediaCodecList.secureDecodersExplicit();
// Note: MediaCodecList is sorted by the framework such that the best decoders come first.
Log.e("!!!", " --------- secure explicit? : " + secureDecodersExplicit);
for (int i = 0; i < numberOfCodecs; i++) {
MediaCodecInfo info = mediaCodecList.getCodecInfoAt(i);
#!/bin/sh
# Determines who is logged in and then kills SEP and relaunches sans reboot.
# Get logged in user from /dev/console
loggedInUser=`ls -l /dev/console | awk '{ print $3 }'`
if [ "$loggedInUser" != "admin" ]
then
launchctl unload /Library/LaunchDaemons/com.symantec.Sched501-1.plist
@uupaa
uupaa / end.of.browser.wars.3rd.md
Last active October 30, 2015 18:19
第三次ブラウザ戦争がそろそろ閉幕します

Chromeのシェアが50%を超え、それと相反するようにIEのシェアが低迷し、
ついにFirefoxのシェアと並びました。
(10年前なら誰も信じてくれませんね、このグラフ)

IEがシェアを失い続け、Chrome がシェアを獲得し続ける事が見えてしまっているため、
第三次ブラウザ戦争もそろそろフィナーレ、閉幕となります。

標準化から分化と特化へ

@j3tm0t0
j3tm0t0 / connect_air.sh
Last active April 13, 2018 15:53
SORACOM Air + FS01BU or AK-020 を、Raspberry Pi や Intel Edison (debianインストール&USB-OTGケーブルで接続) で使用するための接続スクリプト(要: wvdial / usb-modeswitch)と、init用スクリプト by dietposter
#!/bin/bash
init_fs01bu()
{
usb_modeswitch -t <<EOF
DefaultVendor= 0x$1
DefaultProduct= 0x$2
TargetVendor= 0x$3
TargetProduct= 0x$4
MessageEndpoint= not set
MessageContent="55534243123456780000000080000606f50402527000000000000000000000"
@paulirish
paulirish / what-forces-layout.md
Last active June 3, 2024 15:29
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent