Skip to content

Instantly share code, notes, and snippets.

@codebytes
codebytes / DevMachineSetup.ps1
Last active April 8, 2024 17:25
DevMachineSetup
#Install WinGet
#Based on this gist: https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901
$hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") {
"Installing winget Dependencies"
Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
$releases_url = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
@hyuki
hyuki / twitter-markdown.rb
Last active July 21, 2022 10:33
twitter-markdown.rb - convert tweet to markdown.
#!/usr/bin/env ruby
# encoding: utf-8
require 'twitter'
require 'open-uri'
require 'date'
require 'uri'
# $ grep TWITTER_MARKDOWN ~/.bash_profile
# export TWITTER_MARKDOWN_consumer_key=XXXXXXXXXXXXXXXXXXXXXXXXXXX
@WorldDownTown
WorldDownTown / append_google_sheets.sh
Last active December 20, 2022 02:04
Google Sheets の最終行に追記するスクリプト
#!/bin/bash
# Google Sheets の最終行に追記するスクリプト
# 訳あって最終行の位置を特定するために行数を取得している
# OAuth周りは下記がわかりやすい
# https://qiita.com/shin1ogawa/items/49a076f62e5f17f18fe5
CLIENT_ID="Google API ClientID"
CLIENT_SECRET="Google API's client secret"
REFRESH_TOKEN="Google API's refresh token"
@sile
sile / README.md
Last active April 1, 2024 07:33
Optunaを使ってFFmpegのエンコードパラメータを最適化してみる

概要

  • Optunaというハイパーパラメータ最適化ツールを使って、FFmpegでの動画エンコードパラメータの最適化を試してみた結果のメモ
  • 具体的には、決められた制約(後述)下で、画質(SSIM)を最大化するようなパラメータ群を自動で見つけ出すのが目的
  • 結果としては、
    • 画質的には、FFmpegが提供しているプリセットの中で二番目に重いもの(slower)より若干良い程度のパラメータ群が見つかった
    • また、Optunaが見つけたパラメータ群の方がslowerに比べて、CPU負荷が小さかった

方針

# Based on
# https://gist.github.com/jessfraz/7c319b046daa101a4aaef937a20ff41f
# https://gist.github.com/NickCraver/7ebf9efbfd0c3eab72e9
#--- Uninstall unnecessary applications that come with Windows out of the box ---
# Microsoft
Get-AppxPackage Microsoft.3DBuilder | Remove-AppxPackage
Get-AppxPackage Microsoft.BingFinance | Remove-AppxPackage
@amit-chahar
amit-chahar / download-script.sh
Last active February 20, 2023 12:57
Scirpt to download files from Google drive using curl (Detailed explanation can be read here: https://stackoverflow.com/a/49444877/4043524)
#!/bin/bash
fileid="FILEIDENTIFIER"
filename="FILENAME"
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null
curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${fileid}" -o ${filename}
@imksoo
imksoo / itamae_environment.md
Created April 5, 2017 06:27
Itamaeで擬似的にEnvironmentを再現する

Itamaeで擬似的にEnvironmentを設ける時の書き方

Itamae実行時にノードアトリビュートを与えて実行する(itamae -y node.yaml recipe.rb or itamae -j node.json recipe.rb)が、 そのノードアトリビュート内部で擬似的にEnvironment変数を設定しておく。

# nodes/hogehoge-web-server.yaml
environment: development
cookbooks:
    - dnsmasq
@alexjebens
alexjebens / ghost-network-adapters-powershell.ps1
Last active January 22, 2023 22:55
Remove Ghost Network Adapters with PowerShell only
$T = @"
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Win32
{
public static class SetupApi
{
// 1st form using a ClassGUID only, with Enumerator = IntPtr.Zero
@t32k
t32k / make.md
Last active February 3, 2022 05:21

コマンド修飾子

  • @ コマンドを表示しない
  • - コマンドのエラーを無視する
  • + just printオプション指定時でも実行する

make変数

  • MAKE_VERSION GNU make のバージョン番号
  • CURDIR 現在実行しているmakeプロセスのカレントディレクトリ
@nsisodiya
nsisodiya / docker.sh
Created August 15, 2015 06:22
Upgrade to Docker 1.8 on ubuntu box
sudo su
echo deb https://apt.dockerproject.org/repo ubuntu-`cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d'=' -f2` main >> /etc/apt/sources.list.d/docker.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F76221572C52609D
apt-get update
apt-get purge lxc-docker*
apt-get purge docker.io*
apt-get install docker-engine
exit