Skip to content

Instantly share code, notes, and snippets.

@pojntfx
pojntfx / main.sh
Last active May 18, 2024 07:53
Bluesky/AT Protocol: cURL API Interaction Cheatsheet
#!/bin/bash
# This script resolves a DID, retrieves an API key, fetches a user's feed,
# and posts a "Hello, world" message to the user's feed.
# Resolve DID for handle
HANDLE='felicitas.pojtinger.com'
DID_URL="https://bsky.social/xrpc/com.atproto.identity.resolveHandle"
export DID=$(curl -G \
--data-urlencode "handle=$HANDLE" \
docker system prune
docker container prune
docker rm -f `docker ps -a -q`
docker image prune
docker rmi $(docker images -a -q)
docker volume prune
docker network prune
@talkingmoose
talkingmoose / Jamf Pro Provisioning 2.zsh
Created November 16, 2020 06:25
Runs when called by a Jamf Pro policy triggered by Enrollment Complete. Installs third party software that Apple's Volume Purchase Program (VPP) cannot install and runs maintenance routines (bind to Active Directory, set time zone etc.).
#!/bin/zsh
<<'ABOUT_THIS_SCRIPT'
-----------------------------------------------------------------------
Written by:William Smith
Professional Services Engineer
Jamf
bill@talkingmoose.net
@apalepu23
apalepu23 / test_millionaires_problem.js
Created June 7, 2019 21:08
Millionaires' Problem Test
const fs = require('fs');
const path = require('path');
const dotenv = require('dotenv');
const {Enigma, utils, eeConstants} = require('enigma-js/node');
var EnigmaContract;
if(typeof process.env.SGX_MODE === 'undefined' || (process.env.SGX_MODE != 'SW' && process.env.SGX_MODE != 'HW' )) {
console.log(`Error reading ".env" file, aborting....`);
process.exit();
} else if (process.env.SGX_MODE == 'SW') {
@maltekrupa
maltekrupa / basic-auth.swift
Last active September 10, 2021 05:18
HTTP Basic Authentication using URLSession and URLCredentialStorage in swift 4 with xcode 9
import Foundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
let credential = URLCredential(user: “username@gmail.com”, password: “password”, persistence: URLCredential.Persistence.forSession)
let protectionSpace = URLProtectionSpace(host: "example.com", port: 443, protocol: "https", realm: "Restricted", authenticationMethod: NSURLAuthenticationMethodHTTPBasic)
URLCredentialStorage.shared.setDefaultCredential(credential, for: protectionSpace)
let config = URLSessionConfiguration.default
@wbchn
wbchn / bbr.sh
Last active February 9, 2023 01:10
DONNOT USING. bbr install script for linux
#!/usr/bin/env bash
#
# Auto install latest kernel for TCP BBR
#
# System Required: CentOS 6+, Debian7+, Ubuntu12+
#
# Copyright (C) 2016-2017 Teddysun <i@teddysun.com>
#
# URL: https://teddysun.com/489.html
#
@rizumita
rizumita / CodePiece.swift
Created June 8, 2017 05:41
Swift4のCodableでフラットなJSONからネストしたオブジェクトにデコードしてみた。値は取得できたけど、これで正しい方法なのかな? #swift #CodePiece
import Foundation
struct User: Codable {
struct Address: Codable {
let street: String
let city: String
let state: String
}
let name: String
let address: Address
@kudarisenmon
kudarisenmon / ds18b20.sh
Created December 11, 2016 02:46
Raspberry Piに接続されたDS18B20で取得した温度をAmbientにアップロードするスクリプト
#!/bin/bash
AmbientChannelId=700 # 自分のチャネルIDに置き換えてください
AmbientWriteKey="your_writekey" # 自分のライトキーに置き換えてください
DeviceId="28-03146b3a47ff" # 自分のデバイスIDに置き換えてください
INTERVAL=60 # 取得間隔(秒)
while true;do
temp=`cat /sys/bus/w1/devices/$DeviceId/w1_slave | awk 'BEGIN {FS="="} NR==2{print $2 / 1000.0}'`
JSON="{\"writeKey\":\"${AmbientWriteKey}\",\"d1\":\"${temp}\"}"
@uiur
uiur / 0.md
Last active November 23, 2016 14:47
gyapc LT

cat image.png | filter | gyazo

画像を処理して遊んだり開発したりするときのtipsを共有します

自己紹介

@uiureo ウイウ

ネオ目黒ライン NEO MEGURO LINE

最近、ネオ目黒ラインというサービスを作りました

https://mesen-dot-uiu-server.appspot-preview.com/

@MtShadow
MtShadow / idcard.py
Created May 7, 2016 11:35
nfcpyを使って筑波大学の学生証から情報を引き抜く
import nfc
servc = 0x100B
def connected(tag):
service_code = [nfc.tag.tt3.ServiceCode(servc >> 6, servc & 0x3f)]
bc_id = [nfc.tag.tt3.BlockCode(i) for i in range(3)]
bc_name = [nfc.tag.tt3.BlockCode(3)]
print tag.read_without_encryption(service_code, bc_id) # 学籍番号を含むID
print tag.read_without_encryption(service_code, bc_name).decode('shift-jis') # 半角カナの名前