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
find ./folder/ -type f -name '*.php' | xargs file -i | grep unknown | |
iconv -f SHIFT-JIS -t UTF-8 ./folder_org/index.php > folder/index.php | |
find ./folder -type f | xargs -I '{}' echo 'iconv -f SHIFT-JIS -t UTF-8 {} > ../xxxx/{}' |
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
use DBI; | |
$database="db_name"; | |
$hostname="localhost"; | |
$port="3306"; | |
$user="xxx"; | |
$password="xxx"; | |
my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port"; | |
my $dbh = DBI->connect($dsn, $user, $password, {mysql_enable_utf8 => 1}); | |
my $sql = "select * from order limit 10"; |
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 datetime | |
start_date = datetime.date(2020, 1, 1) | |
end_date = datetime.date(2020, 1, 4) | |
delta = datetime.timedelta(days=1) | |
while start_date <= end_date: | |
print(start_date) | |
start_date += delta |
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 pandas as pd | |
df = pd.read_csv('data.csv', encoding='sjis') | |
df.head() | |
df_seq = df['some_seq_num'] | |
df_seq_dup = df_seq[df_seq.duplicated()] | |
print(df_seq_dup) |
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://unix.stackexchange.com/questions/276741/using-grep-and-looking-for-unique-occurrences | |
grep --only-matching 'mapper \[.*\]' app.log | sort -u |
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
-- hammerspoon config | |
hs.hotkey.bind({"ctrl", "alt"}, "Z", function() | |
-- hs.alert.show("Hello World!") | |
hs.eventtap.keyStrokes("some string you want to input") | |
end) |
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
# Copyright 2018 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
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
# Delete log files older than 7 days | |
appender.rolling.strategy.type = DefaultRolloverStrategy | |
appender.rolling.strategy.delete.type = Delete | |
appender.rolling.strategy.delete.basePath = ${sys:ls.logs} | |
appender.rolling.strategy.delete.maxDepth = 1 | |
appender.rolling.strategy.delete.ifLastModified.type = IfLastModified | |
appender.rolling.strategy.delete.ifLastModified.age = 7d |
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
def getPath(grid): | |
if not grid or len(grid) == 0: | |
return [] | |
R = len(grid) | |
C = len(grid[0]) | |
path = [] | |
memo = [[False]*C for i in range(R)] # memorization | |
calcPath(grid, R-1, C-1, path, memo) |
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://www.geeksforgeeks.org/printing-paths-dijkstras-shortest-path-algorithm/ | |
#Class to represent a graph | |
class Graph: | |
# A utility function to find the | |
# vertex with minimum dist value, from | |
# the set of vertices still in queue | |
def minDistance(self,dist,queue): | |
# Initialize min value and min_index as -1 |
NewerOlder