This file contains 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 bash | |
read -p 'Enter a number : ' num | |
seq $((10**num)) | egrep -v "([0-9]).*\1" | xargs echo | sed 's/ /, /g' |
This file contains 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/python3 | |
import random, re | |
collection = ('A1-1', 'A1-2', 'A1-3', 'A1-4', 'A1-5', 'A1-6', 'A1-7', 'A1-8', 'A1-9', 'A1-10', 'A1-11', 'A1-12', 'A1-13', 'A1-14', 'A2-1', 'A2-3', 'A2-4', 'A2-5', 'A2-6', 'A2-7', 'A2-8', 'A2-9', 'A2-10', 'A2-11', 'A2-12', 'A2-13', 'A2-14', 'A3-1', 'B1-3', 'B1-4', 'B1-5', 'B1-6', 'B1-7', 'B1-8', 'B1-9', 'B1-10', 'B1-11', 'B1-12', 'B2-3', 'B2-4', 'B2-5', 'B2-6', 'B2-7', 'B2-8', 'B2-9', 'B2-10', 'B2-11', 'B2-12') | |
print('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>機車腳踏車車位選填志願抽籤結果</title>') | |
print('''<style> | |
table {border: 0; border-collapse: collapse; width: 100%; table-layout: fixed;} | |
td,th {border: 1px solid black;} |
This file contains 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
var scores = [98, 74, 85, 77, 93, 100, 89]; | |
var total = 0; | |
for (var score in scores) { | |
total += score; | |
} | |
var mean = total / scores.length; | |
console.log(mean); |
This file contains 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
function Scene(context, width, height, images) { | |
this.context = context; | |
this.width = width; | |
this.height = height; | |
this.images = images; | |
this.actors = []; | |
} | |
Scene.prototype.register = function(actor) { | |
this.actors.push(actor); |
This file contains 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 python3 | |
def find_duplicate(vbt_min, pwm_max): | |
prev = -1 | |
pwm_min = round(vbt_min * pwm_max / 255) | |
print("sysfs : PWM") | |
print("-----------") | |
for i in range(pwm_max + 1): | |
pwm = round(i * (pwm_max - pwm_min) / pwm_max + pwm_min) | |
if prev == pwm: |
This file contains 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
#!/bin/sh | |
PARTITIONS="/dev/mmcblk0p1 /dev/mmcblk1p1 /dev/nvm0n1p1 /dev/nvm0n2p1 /dev/sda1 /dev/sdb1" | |
DEVICES="/dev/sdb /dev/nvm0n2 /dev/nvm0n1 /dev/mmcblk0" | |
result="" | |
[...] # can not use PARTITIONS here | |
for partition in $PARTITIONS; do |
This file contains 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/kore: | |
Position Independent Executable: yes | |
Stack protected: yes | |
Fortify Source functions: yes (some protected functions found) | |
unprotected: read | |
unprotected: poll | |
unprotected: fgets | |
unprotected: memset | |
unprotected: getcwd | |
unprotected: memcpy |
This file contains 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
#!/bin/bash | |
export PYENV_ROOT="$HOME/.pyenv" | |
export PATH="$PYENV_ROOT/bin:$PATH" | |
eval "$(pyenv init -)" | |
export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h(python)\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
bash --noprofile -l |
This file contains 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 python3 | |
# | |
# Copyright (C) 2015 Canonical Limited | |
# Author: Shih-Yuan Lee (FourDollars) <sylee@canonical.com> | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# |
This file contains 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 python3 | |
from gi.repository import Clutter, ClutterGst, Gdk | |
class VideoPlayer: | |
def __init__(self, filename): | |
stage_color = Clutter.Color.new(0, 0, 0, 0) | |
screen = Gdk.Screen.get_default() | |
monitor = screen.get_primary_monitor() |